{extend name="layout/iframe" /}
{block name="pagecss"}
<style>
    .layui-form-select .layui-input{
        padding-right: 0;
        cursor: pointer;
    }
    input::-webkit-input-placeholder {
        text-align:right;
    }
</style>
{/block}
{block name="content"}
<div class="layui-card-body layui-layout-admin" style="padding: 15px;">
    <form class="layui-form" action="" lay-filter="component-form-group">
        <div class="layui-form-item">
            <label class="layui-form-label"><span class="required">*</span>优惠券类型</label>
            <div class="layui-input-block">
                <select lay-filter="type" name="coupon_type" id="coupon_type" lay-verify="coupon_type">
                    <option value="0">请选择</option>
                    {foreach $type as $k => $v}
                    <option value="{$k}">{$v}</option>
                    {/foreach}
                </select>
            </div>
        </div>
        <div class="layui-form-item layui-hide productType">
            <label class="layui-form-label"><span class="required">*</span>选择品类</label>
            <div class="layui-input-inline">
                <div class="layui-form-item">
                    {foreach $category as $v}
                    <input style="width: 100%;" type="checkbox" name="category_id[]" lay-skin="primary" title="{$v.name}" value="{$v.id}" >
                    {/foreach}
                </div>
            </div>
        </div>
        <div class="layui-form-item layui-hide product">
            <label class="layui-form-label"><span class="required">*</span>选择优惠商品</label>
            <div class="layui-input-block">
                <button class="layui-input" lay-event="purchase-o" id="product_name" type="button"  data-title="选择">请选择</button>
                <input type="hidden" name="product_id" lay-verify="product_id" id="product_id" value="">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label"><span class="required">*</span>优惠券名称</label>
            <div class="layui-input-block">
                <input type="text" class="layui-input" name="name" lay-verify="name" placeholder="请输入" autocomplete="off">
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label"><span class="required">*</span>优惠券用途</label>
            <div class="layui-input-block">
                <select name="coupon_purpose" id="coupon_purpose" lay-filter="coupon_purpose" lay-verify="coupon_purpose">
                    <option value="0">请选择</option>
                    {foreach $purpose as $k => $v}
                    <option value="{$k}">{$v}</option>
                    {/foreach}
                </select>
            </div>
        </div>

        <div class="layui-form-item layui-hide number">
            <label class="layui-form-label"><span class="required">*</span>优惠券数量</label>
            <div class="layui-input-block">
                <input type="text" class="layui-input" lay-filter="number" name="number" lay-verify="number" placeholder="请输入" autocomplete="off">
            </div>
        </div>


        <div class="layui-form-item">
            <label class="layui-form-label"><span class="required">*</span>开始日期</label>
            <div class="layui-input-inline">
                <input type="text" class="layui-input" id="start_time" name="start_time" lay-verify="required">
            </div>　　
            <label class="layui-form-label" style="width: 20%"><span class="required">*</span>结束日期</label>
            <div class="layui-input-inline" >
                <input type="text" class="layui-input" id="end_time" name="end_time" lay-verify="required">
            </div>
        </div>
        <div class="layui-form-item layui-hide threshold">
            <label class="layui-form-label">使用门槛</label>
            <div class="layui-input-block">
                <input type="text" class="layui-input" name="threshold" lay-verify="threshold" placeholder="元" autocomplete="off" >
            </div>
        </div>
        <div class="layui-form-item layui-hide amount">
            <label class="layui-form-label"><span class="required">*</span>抵现金额</label>
            <div class="layui-input-block">
                <input type="text" class="layui-input" name="cash_amount" lay-verify="cash_amount" placeholder="元" autocomplete="off" >
            </div>
        </div>

        <div class="layui-form-item layui-hide strength">
            <label class="layui-form-label"><span class="required">*</span>折扣力度</label>
            <div class="layui-input-block">
                <input type="text" class="layui-input" name="discount_strength" lay-verify="discount_strength" placeholder="折" autocomplete="off">
            </div>
        </div>

        <div class="layui-form-ite" style="margin:50px 0 0 50px;">
            <label style="color: #c2c2c2;">（抵现券必须填写使用门槛）</label>
        </div>
        <div class="layui-form-item layui-row layui-col-xs12">
                <div class="layui-footer">
                    <button type="button" class="layui-btn layui-btn-primary close-btn">取消</button>
                    <button class="layui-btn" type="button" lay-submit="" lay-filter="laySave">保存 <i class="layui-icon">&#xe609;</i></button>
                </div>
        </div>
    </form>
</div>


<input type="hidden" class="token_url" value="{:url('admin/Image/token')}">
<input type="hidden" class="record_url" value="{:url('admin/Image/record')}">
<input type="hidden" class="delimage_url" value="{:url('admin/Image/delete')}">
<input type="hidden" class="save_url" value="{:url('admin/'.strtolower($model).'/addpost')}">
<input type="hidden" class="get_product_url" value="{:url('admin/'.strtolower($model).'/get_product')}">
<input type="hidden" class="handle_url" value="{:url('admin/'.strtolower($model).'/handle')}">
{/block}

{block name="pagescript"}


<script src="__STATIC__/admin/pages/js/promotion.js" type="text/javascript"></script>
{/block}